package com.why.websocketmqttstudy.why.mqtt.handle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Service
public class HandlerFactory {

	@Autowired
    Map<String, PocMsgHandler> handlerList = new ConcurrentHashMap<>(3);
	
	/**
	 * 获取已经注册的Handler
	 * @param component
	 * @return
	 * @throws Exception
	 */
    public PocMsgHandler getHandler(String component) throws Exception{
    	PocMsgHandler handler = handlerList.get(component);
        return handler;
    }
}
